{% extends "base.html" %}
{# Page d'inscription #}

{% block title %}{{ pageTitle}}{% endblock %}

{% block content %}

<h1>{{ pageTitle }}</h1>

{% if errors.csrf %}
	<div class="error">
		{{errors.csrf}}
	</div>
{%endif%}

<form class="formulaire" action="" method="post">
	{{crsfToken|raw}}

	<div id="trackForm" class=""> 
		<label for="id_track">Track</label> 
		<select id="id_track" name="track" >
		<option value="" class="selectHeader">choose the track</option>
		{% for track in tracks %}
			<option value="{{track.id}}" {% if track.id == valueTrack %}selected="selected"{% endif %}>{{track.name}}</option>
		{% endfor %}
		</select>
		{% if errors.track %}<div class="fieldError">
			{{errors.track}}
		</div>{%endif%}
	</div> 

	<div id="typeForm" class=""> 
		<label>Type</label>
		{% for type in types %}
			<input type="radio" name="type" value="{{type.id}}" {% if type.id == valueType %}checked="checked"{% endif %} />{{type.name}}
		{% endfor %}
		{% if errors.type %}<div class="fieldError">
			{{errors.type}}
		</div>{%endif%}
	</div> 

	<div id="modeForm" class=""> 
		<label>Mode</label>
		{% for mode in modes %}
			<label id="label_{{mode.mode}}"><input type="radio" name="mode" value="{{mode.id}}" {% if mode.id == valueMode %}checked="checked"{% endif %} />{{mode.mode}}</label>
		{% endfor %}
		{% if errors.mode %}<div class="fieldError">
			{{errors.mode}}
		</div>{%endif%}
	</div> 

	<div id="cheatsForm" class=""> 
		<label>Cheats</label>
			<input type="checkbox" name="ice" value="1" {% if valueIce == 1 %}checked="checked"{% endif %} /> Ice
			<input type="checkbox" name="stp" value="1" {% if valueIStp == 1 %}checked="checked"{% endif %} /> SuperTurboPad
		{% if errors.ice or errors.stp %}<div class="fieldError">
			{{errors.ice}} {% if errors.ice and errors.stp %}<br />{%endif%}
			{{errors.stp}}
		</div>{%endif%}
	</div> 

	<div id="versionForm" class=""> 
		<label>Version</label>
		{% for version in versions %}
        	{% if version.name !="NC" %}
			<input type="radio" name="version" value="{{version.id}}" {% if version.id == valueVersion %}checked="checked"{% endif %} />{{version.name}}
            {% endif %}
		{% endfor %}
		{% if errors.version %}<div class="fieldError">
			{{errors.version}}
		</div>{%endif%}
	</div> 

	<div id="driverForm" class=""> 
		<label for="id_driver">Driver</label> 
		<select id="id_driver" name="driver" >
		<option value="" class="selectHeader">choose the driver</option>
		{% for driver in drivers %}
			<option value="{{driver.id}}" {% if driver.id == valueDriver %}selected="selected"{% endif %}>{{driver.name}}</option>
		{% endfor %}
		</select>
		{% if errors.driver %}<div class="fieldError">
			{{errors.driver}}
		</div>{%endif%}
	</div> 

	<div id="timeForm" class=""> 
		<label>Time</label>
		<span style='display:none' class="onNegativeTime"><b>-</b></span>
		<select id="id_time_m" name="minute" >
		<option value="" class="selectHeader"></option>
		{% for i in 0..9 %}
			<option value="{{ i }}" {% if i == valueMinute %}selected="selected"{% endif %}>{{ i }}</option>
		{% endfor %}
		</select>
		Minute
		<select id="id_time_s" name="second" >
		<option value="" class="selectHeader"></option>
		{% for i in 0..59 %}
			<option value="{{ i }}" {% if i == valueSecond %}selected="selected"{% endif %}>{{ i }}</option>
		{% endfor %}
		</select>
		Second
		<select id="id_time_h" name="hundredth" >
		<option value="" class="selectHeader"></option>
		{% for i in 0..99 %}
			<option value="{{ i }}" {% if i == valueHundredth %}selected="selected"{% endif %}>{{ i }}</option>
		{% endfor %}
		</select>
		Hundredth
		{% if errors.minute or errors.second or errors.hundredth %}<div class="fieldError">
			{% if errors.minute %}{{errors.minute}}<br />{%endif%}
			{% if errors.second %}{{errors.second}}<br />{%endif%}
			{{errors.hundredth}}
		</div>{%endif%}
		<div id="negativeTimeForm" class="relicOption">
			<input type="checkbox" name="neg" value="1" {% if valueNeg == 1 %}checked="checked"{% endif %} /> This is a negative time
		</div>
	</div> 

	<div id="proofForm" class="absoluteLabel"> 
		<label for="id_proof">Proof</label> 
		<input id="id_proof" type="text" name="proof" maxlength="255" value="{{valueProof}}" /> 
		<div class="formHelp"> 
			Put the link of your best proof (video or photo) here
		</div> 
		{% if errors.proof %}<div class="fieldError">
			{{errors.proof}}
		</div>{%endif%}
	</div> 

	
	<input type="submit" name="submit" value="Submit" /> 
    </form> 
 
{% endblock content %}